﻿using Dapper;
using System;
using BCEntity.Sim.Admin.StaffOrganizationMappingRecord;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Sim.Admin.StaffOrganizationMappingRecord
{
    /// <summary>
    /// 员工组织映射记录
    /// </summary>
    public interface IStaffOrganizationMappingRecordData
    {
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="staffOrganizationMappingRecordId">员工组织映射记录Id</param>
        Task<bool> Exists(long staffOrganizationMappingRecordId);
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="departmentId">部门Id</param>
        /// <param name="adminId">员工Id</param>
        /// <returns></returns>
        Task<bool> Exists(int companyId, int departmentId, long adminId);
        /// <summary>
        /// 是否已存在对应部门关系
        /// </summary>
        /// <param name="departmentPath">部门路径码</param>
        /// <param name="adminId">员工Id</param>
        /// <returns></returns>
        Task<bool> Exists(string departmentPath, long adminId);
        /// <summary>
        /// 检查是否在使用中
        /// </summary>
        /// <param name="jobTitleNo">职位编号</param>
        /// <returns></returns>
        Task<bool> InUse(string jobTitleNo);
        /// <summary>
        /// 检查是否在使用中
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="positionNo">岗位编号</param>
        /// <returns></returns>
        Task<bool> InUse(int companyId,string positionNo);
        /// <summary>
        /// 增加员工组织映射记录
        /// </summary>
        /// <param name="entity">员工组织映射记录信息</param>
        Task<StaffOrganizationMappingRecordEntity> Add(StaffOrganizationMappingRecordEntity entity);
        /// <summary>
        /// 更新员工组织映射记录
        /// </summary>
        /// <param name="entity">员工组织映射记录信息</param>
        Task<StaffOrganizationMappingRecordEntity> Update(StaffOrganizationMappingRecordEntity entity);
        /// <summary>
        /// 删除员工组织映射记录
        /// </summary>
        /// <param name="staffOrganizationMappingRecordId">员工组织映射记录Id</param>
        Task<bool> Delete(long staffOrganizationMappingRecordId);
        /// <summary>
        /// 设置员工组织映射记录为活动记录
        /// </summary>
        /// <param name="staffOrganizationMappingRecordId">员工组织映射记录Id</param>
        void SetActiveRole(long staffOrganizationMappingRecordId);
        /// <summary>
        /// 获取员工组织映射记录
        /// </summary>
        /// <param name="staffOrganizationMappingRecordId">员工组织映射记录Id</param>
        Task<StaffOrganizationMappingRecordEntity> GetEntity(long staffOrganizationMappingRecordId);
        /// <summary>
        /// 获取员工组织映射记录
        /// </summary>
        /// <param name="departmentPath">部门路径码</param>
        /// <param name="adminId">员工Id</param>
        /// <returns></returns>
        Task<StaffOrganizationMappingRecordEntity> GetEntity(string departmentPath, long adminId);
        /// <summary>
        /// 获取员工活动中的组织映射记录
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <returns></returns>
        Task<StaffOrganizationMappingRecordEntity> GetActiveEntity(long adminId);
        /// <summary>
        /// 获取员工组织映射记录列表
        /// </summary>
        /// <param name="adminId">员工Id</param>
        Task<IEnumerable<StaffViewEntity>> GetList(long adminId);
        /// <summary>
        /// 获取员工组织映射记录列表
        /// </summary>
        /// <param name="adminIds">员工Ids</param>
        /// <returns></returns>
        Task<IEnumerable<StaffViewEntity>> GetList(long[] adminIds);
        /// <summary>
        /// 获取员工组织映射记录列表(公司下所有员工)
        /// </summary>
        /// <param name="companyId">公司Id</param>
        Task<IEnumerable<StaffViewEntity>> GetCompanyStaffList(int companyId);
        /// <summary>
        /// 获取员工资质映射记录列表（部门下所有员工）
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        Task<IEnumerable<StaffViewEntity>> GetDepartmentStaffList(int departmentId);
        /// <summary>
        /// 获取当前部门下员工列表，不包含子级
        /// </summary>
        /// <param name="departmentId"></param>
        /// <returns></returns>
        Task<IEnumerable<StaffViewEntity>> GetCurrentlyDepartmentStaffList(int departmentId);
        /// <summary>
        /// 获取无部门公司员工列表
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        Task<IEnumerable<StaffViewEntity>> GetNoneStaffList(int companyId, int departmentId);
        /// <summary>
        /// 获取员工资质映射记录列表（此职位下所有员工）
        /// </summary>
        /// <param name="jobTitleKey">职位</param>
        /// <returns></returns>
        Task<IEnumerable<StaffViewEntity>> GetJobTitleStaffList(string jobTitleKey);
        /// <summary>
        /// 获取员工资质映射记录列表（此岗位下所有员工）
        /// </summary>
        /// <param name="position">岗位</param>
        /// <returns></returns>
        Task<IEnumerable<StaffViewEntity>> GetPositionStaffList(string position);
        /// <summary>
        /// 获取员工列表
        /// </summary>
        /// <param name="staffName">员工姓名</param>
        /// <returns></returns>
        Task<IEnumerable<StaffViewEntity>> GetStaffList(string staffName);
        /// <summary>
        /// 获取员工组织映射记录分页列表
        /// </summary>
        /// <param name="companyName">公司名称</param>
        /// <param name="departmentName">部门名称</param>
        /// <param name="adminName">员工姓名</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        Task<(IEnumerable<StaffOrganizationMappingRecordEntity>, int)> Query(string companyName, string departmentName, string adminName, DateTime? start, DateTime? end, int pageIndex, int pageSize);
        #endregion  成员方法
    }


}